let actions = {
  addCart(context, payload) {
    return new Promise((resolve, reject) => {
      // console.log(context);
      // console.log(payload.iid);
      let oldProduct = context.state.cartList.find(item => item.iid === payload.iid);
      // find找到并返回结果，没找到返回undefined
      // console.log(oldProduct);

      if (oldProduct) {
        context.commit("addCount", oldProduct)
        resolve(0)
      } else {
        context.commit("addToCart", payload)
        resolve(1)
      }
    });
  }
}
export default actions